#import "objc_class.h"
#import "objc_sel.h"
#import "objc_protocol.h"
#import "objc_malloc.h"
#import "ObjCException.h"
#import "ObjCModule.h"
#import <stdio.h>
typedef int ptrdiff_t;

/* Write barriers.  Used by the compiler.  */
#if 0
id objc_assign_strongCast(id val, id *dest)
{
	printf("objc_assign_strongCast: %x %x \n",(int)val,(int)dest);
	return (*dest=val);
	
}
#endif
id objc_assign_global(id val, id *dest)
{
	printf("objc_assign_global: %x %x \n",(int)val,(int)dest);
	return (*dest=val);
}
#if 0
id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
{
	id* ref=(id*)((char*)dest+offset);
	*ref=value;
	//printf("objc_assign_ivar: %x %x %x\n",(int)value,(int)dest,offset);
	return value;
}
#endif
//TODO
void *objc_memmove_collectable(void *dst, const void *src, size_t size)
{
	memmove(dst,src,size);
}



 id objc_read_weak(id *location)
 {
	return *location;	
 }
 id objc_assign_weak(id value, id *location)
 {
	printf("objc_assign_weak: %x %x \n",(int)value,(int)location);
	return (value=*location);
 }

//FIXME how does Leopard/GNUstep2.0 store weak ivar layouts
//PATCH clang to be compatible with Leopard

